<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<portlet:defineObjects/>
<input 
	type="text" 
	name="<c:out value="${field.def.name}"/>" 
	id="id_<c:out value='${field.def.name}'/>" 
	readonly="1" 
	value="<c:out value="${field.value}"/>"/>
<img 
	src="<%= 
	    renderResponse.encodeURL(renderRequest.getContextPath() + "/jscalendar/img.gif")
	%>" 
	id="<c:out value='${field.def.name}'/>c" 
	style="cursor: pointer; border: 1px solid red;" 
	title="Date selector"
	onmouseover="this.style.background='red';" 
	onmouseout="this.style.background=''" />	

<script type="text/javascript">
   Calendar.setup({
       inputField     :    "id_<c:out value='${field.def.name}'/>",     // id of the input field
       ifFormat       :    "%Y/%m/%d %H:%M:%S",      // format of the input field
       daFormat       :    "%Y/%m/%d %H:%M:%S",      // format of the input field
       button         :    "<c:out value='${field.def.name}'/>c",  // trigger for the calendar (button ID)
       align          :    "Tl",           // alignment (defaults to "Bl")
       singleClick    :    true,
       showsTime	  :    true
   });
</script>

<script language="javascript" type="text/javascript">
	document.getElementById('id_<c:out value="${field.def.name}"/>')
		.realname= '<c:out value="${field.def.label}"/>';
	<c:if test="${not field.def.nullable}">
		document.getElementById('id_<c:out value="${field.def.name}"/>').required=true ;
	</c:if>	
</script>